package com.xk857.simpleeffect.domain.entity;

import com.google.gson.annotations.SerializedName;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

public class Project {

    @SerializedName("id")
    private Integer id;
    @SerializedName("name")
    private String name;
    @SerializedName("createTime")
    private List<Integer> createTime;
    @SerializedName("finishTime")
    private List<Integer> finishTime;
    @SerializedName("elaborate")
    private String elaborate;
    @SerializedName("customerId")
    private Integer customerId;
    @SerializedName("sort")
    private Integer sort;
    @SerializedName("deleted")
    private Boolean deleted;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public LocalDateTime getCreateTime() {
        if (createTime.size() == 5) {
            return LocalDateTime.of(createTime.get(0), createTime.get(1), createTime.get(2), createTime.get(3), createTime.get(4), 0);
        }
        return LocalDateTime.of(createTime.get(0), createTime.get(1), createTime.get(2), createTime.get(3), createTime.get(4), createTime.get(5));
    }

    public void setCreateTime(List<Integer> createTime) {
        this.createTime = createTime;
    }

    public LocalDate getFinishTime() {
       if (finishTime == null || finishTime.size() < 3) {
           return null;
       }
        return LocalDate.of(finishTime.get(0),finishTime.get(1),finishTime.get(2));
    }

    public void setFinishTime(List<Integer> finishTime) {
        this.finishTime = finishTime;
    }

    public String getElaborate() {
        return elaborate;
    }

    public void setElaborate(String elaborate) {
        this.elaborate = elaborate;
    }

    public Integer getCustomerId() {
        return customerId;
    }

    public void setCustomerId(Integer customerId) {
        this.customerId = customerId;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public Boolean getDeleted() {
        return deleted;
    }

    public void setDeleted(Boolean deleted) {
        this.deleted = deleted;
    }
}
